package com.sunlee.app.api.controller;

import com.sunlee.common.core.entity.Result;
import com.sunlee.common.service.entity.vo.CarouselVO;
import com.sunlee.common.service.service.MarketingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author sunjulei
 * @date 2022/6/28
 */
@RestController
@RequestMapping("marketing")
public class MarketingController {

    @Autowired
    private MarketingService marketingService;

    /**
     * 根据营销类型查询商品
     *
     * @param type 类型ID
     * @return 营销商品
     */
    @GetMapping("carousel/{type}")
    public Result<CarouselVO> getCarousel(@PathVariable Integer type) {
        return Result.ok(marketingService.getCarousel(type));
    }
}
